<?php

namespace App\Repos;

use App\Models\Notice;
use App\Models\NoticeUser;
use App\Models\User;
class NoticeRepo 
{
    public static function create($data)
    {
    	$notice = Notice::create($data);
    	// 所有用户的id 然后全部查入
    	$user_ids = User::pluck('id');
    	foreach ($user_ids as $k => $v) {
    		$nu['notice_id'] = $notice->id;
    		$nu['to_user_id'] = $v;
    		$nu['is_read'] = 0;
    		NoticeUser::create($nu);
    	}
    	return true;
    }
}
